//package com.icee.myth.server.pipelineFactory;
//
//import com.icee.myth.common.encoder.Type4BytesLengthFieldProtobufEncoder;
//import com.icee.myth.server.channelHandler.ManagerConnectHandler;
//import com.icee.myth.server.channelHandler.PlayerConnectHandler;
//import io.netty.channel.Channel;
//import io.netty.channel.ChannelInitializer;
//import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
//import io.netty.handler.logging.LogLevel;
//import io.netty.handler.logging.LoggingHandler;
//
//
///**
// * ClientToGWPipelineFactory用于GW接收Client的消息和GW向Client发送消息
// *
// * @author liuxianke
// */
//public class CommonToServerPipelineInitializer extends ChannelInitializer<Channel> {
//
//    // stateless handlers
////    private ChannelInboundHandlerAdapter targetHandler;
////    private final Type4BytesLengthFieldProtobufEncoder type4BytesLenthFieldProtobufEncoder = new Type4BytesLengthFieldProtobufEncoder();
//    private PlayerConnectHandler playerConnectHandler;
//    private ManagerConnectHandler managerConnectHandler;
//
////    private static final EventExecutorGroup e1 = new DefaultEventExecutorGroup(20);
//
//    //    public CommonToServerPipelineInitializer(ChannelInboundHandlerAdapter targetHandler) {
////        this.targetHandler = targetHandler;
////    }
//    public CommonToServerPipelineInitializer(PlayerConnectHandler playerConnectHandler, ManagerConnectHandler managerConnectHandler) {
//        this.playerConnectHandler = playerConnectHandler;
//        this.managerConnectHandler = managerConnectHandler;
//    }
//
//    @Override
//    protected void initChannel(Channel ch) throws Exception {
//        ch.pipeline().addLast(new LoggingHandler(LogLevel.DEBUG));
//        ch.pipeline().addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, 0, 0));
//        ch.pipeline().addLast("customEncoder", new Type4BytesLengthFieldProtobufEncoder());
//
//        PlayerConnectHandler playerConnectHandler = new PlayerConnectHandler();
//        if (null != playerConnectHandler) {
//            PlayerConnectHandler newPlayerConnectHandler = (PlayerConnectHandler) playerConnectHandler.clone();
//            ch.pipeline().addLast("targetHandle", newPlayerConnectHandler);
//        }
//        if (null != managerConnectHandler) {
//            ManagerConnectHandler newManagerConnectHandler = (ManagerConnectHandler) managerConnectHandler.clone();
//            ch.pipeline().addLast("targetHandle", newManagerConnectHandler);
//        }
//    }
//
//}
